#include <stdio.h>
#include <stdlib.h>

typedef int ElementType;
typedef struct LIST List;

struct LIST{
	ElementType elm;
	List *next;
};

List *ListInit(void){
	List *l=malloc(sizeof(List));
	l->next=NULL;
	return l;
}
List *ReverseList(List *l){
	List *Old_head,*New_head,*Temp;
	New_head=NULL;
	Old_head=l->next;
	while( Old_head ){
		Temp=Old_head->next;
		Old_head->next=New_head;
		New_head=Old_head;
		Old_head=Temp;
	}
	l->next=New_head;
	return l;
}
void Add(List *l,ElementType elm){
	while( l->next ){
		l=l->next;
	}
	l->next=malloc(sizeof(List));
	l->next->next=NULL;
	l->next->elm=elm;
	return;
}

void Show(List *l){
printf("Show List\n");
	while( l->next ){
		printf("%d--",l->next->elm);
		l=l->next;
	}
printf("\n");
}

int main(void){
	List *l=ListInit();
	Add(l,1);
	Add(l,2);
	Add(l,3);
	Show(l);
	l=ReverseList(l);
	Show(l);
	return 0;
}
